function formatText(type:String, content:String):String
{
	var formatMode=Packages.system.mlf.GateKeeper.accessSystemConfig(type);
	var formatModeArr=formatMode.split("$");
	return formatModeArr[0]+content+formatModeArr[1];
}

function calcContentWidth(content:String, lineWidth:Number, lineHeight:Number):Number
{
	var width:Number;

	this.createTextField("dynContainer", this.getNextHighestDepth(), 0, 0, lineWidth, lineHeight);
	this.dynContainer.text=content;

	width=this.dynContainer.textWidth;
	this.dynContainer.removeTextField();

	return width;
}

function calcContentLines(content:String, property:String, lineWidth:Number, lineHeight:Number):Number
{
	var lines:Number;
	
	this._visible=false;
	this.createTextField("dynContainer", this.getNextHighestDepth(), 0, 0, lineWidth, lineHeight);
	this.dynContainer.multiline=true;
	this.dynContainer.wordWrap=true;
	this.dynContainer[property]=content;

	lines=this.dynContainer.maxscroll;
	this.dynContainer.removeTextField();

	return lines;
}

function checkDefaultValue(target_tf:TextField, value:String):Boolean
{
	var dicValue=Packages.system.mlf.GateKeeper.scanDictionary(target_tf, value);
	var startIndex=dicValue.indexOf("[");
	var endIndex=dicValue.indexOf("]");
	var defaultValue=dicValue.substring(startIndex, endIndex+1);
	if (defaultValue==target_tf.text)
	{
		return true;
	}
	else return false;
}

function setDefaultValue(instance:String, slot:String)
{
	var target_tf=Packages.system.mlf.GateKeeper.scanElement(slot, instance);
	var key=instance.substr(0, 1).toUpperCase()+instance.substr(1);
	var dicValue=Packages.system.mlf.GateKeeper.scanDictionary(target_tf, key);
	target_tf.htmlText=dicValue;
}

function getValue(instance:String, slot:String):String
{
	var target_tf=Packages.system.mlf.GateKeeper.scanElement(slot, instance);
	var key=instance.substr(0, 1).toUpperCase()+instance.substr(1);
	if (checkDefaultValue(target_tf, key))
	{
		return "";
	}
	else return target_tf.text;
}